import 'package:aero_frisbee/gen/assets.gen.dart';
import 'package:aero_frisbee/pages/login/views/af_pop_content_view.dart';
import 'package:flutter/material.dart';

class AfLoginConfirmPopView extends StatelessWidget {
  const AfLoginConfirmPopView({Key? key, this.onTapClick}) : super(key: key);

  final Function()? onTapClick;

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: const BoxDecoration(
        color: Colors.white,
      ),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          const SizedBox(
            height: 20,
          ),
          Align(
            alignment: Alignment.topCenter,
            child: Container(
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(12),
                border: Border.all(
                  color: const Color(0xffEEEEEE),
                  width: 0.5,
                ),
              ),
              child: ClipRRect(
                borderRadius: BorderRadius.circular(12),
                child: Assets.images.appLogo.image(width: 52),
              ),
            ),
          ),
          const SizedBox(
            height: 14,
          ),
          const Align(
            alignment: Alignment.topCenter,
            child: Text(
              'AeroFrisbee',
              style: TextStyle(
                color: Color(0xff404040),
                fontWeight: FontWeight.w600,
                fontSize: 16,
              ),
              textAlign: TextAlign.left,
              overflow: TextOverflow.ellipsis,
              maxLines: 1,
            ),
          ),
          const SizedBox(
            height: 16,
          ),
          const Align(
            alignment: Alignment.topCenter,
            child: Text(
              'By using our App you agree with our  Term of Use  and Privacy Policy.',
              style: TextStyle(
                color: Color(0xff404040),
                fontWeight: FontWeight.normal,
                fontSize: 14,
              ),
              textAlign: TextAlign.center,
              overflow: TextOverflow.ellipsis,
              maxLines: 3,
            ),
          ),
          const SizedBox(
            height: 20,
          ),
          Align(
            alignment: Alignment.topCenter,
            child: GestureDetector(
              behavior: HitTestBehavior.opaque,
              onTap: () {
                Navigator.of(context).pop();
                onTapClick?.call();
              },
              child: Container(
                decoration: BoxDecoration(
                  color: const Color(0xffDDFB6C),
                  borderRadius: BorderRadius.circular(25),
                ),
                padding:
                    const EdgeInsets.symmetric(horizontal: 30, vertical: 13),
                child: const Text(
                  'Agree and Continue',
                  style: TextStyle(
                    color: Color(0xff202020),
                    fontWeight: FontWeight.w500,
                    fontSize: 14,
                  ),
                  textAlign: TextAlign.left,
                  overflow: TextOverflow.ellipsis,
                  maxLines: 1,
                ),
              ),
            ),
          ),
          Align(
            alignment: Alignment.topCenter,
            child: GestureDetector(
              behavior: HitTestBehavior.opaque,
              onTap: () {
                Navigator.of(context).maybePop();
              },
              child: Padding(
                padding:
                    const EdgeInsets.symmetric(vertical: 16, horizontal: 30),
                child: Text(
                  'Cancel',
                  style: TextStyle(
                    color: const Color(0xff000000).withOpacity(0.3),
                    fontWeight: FontWeight.w500,
                    fontSize: 14,
                  ),
                  textAlign: TextAlign.left,
                  overflow: TextOverflow.ellipsis,
                  maxLines: 1,
                ),
              ),
            ),
          ),
          const SizedBox(
            height: 10,
          ),
        ],
      ),
    );
  }
}

showLoginConfirmPopView(BuildContext context, {Function()? onTapClick}) {
  showContentPopView(
    context,
    borderRadius: 10,
    titlePadding: 15,
    contentPadding: 10,
    insetPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 30),
    content: AfLoginConfirmPopView(onTapClick: onTapClick),
  );
}
